		{set:$item = $this->order_info;}
        <div class="main f_r">
			<div class="uc_title m_10">
				<label class="current"><span>订单详情</span></label>
			</div>
			<div class="prompt_2 m_10">
				<div class="t_part">
					<p>{$item['create_time']}&nbsp;&nbsp;<span class="black">订单创建</span></p>
                    {if:$item['pay_status']>0}
					<p>{$item['pay_time']}&nbsp;&nbsp;<span class="black">订单{$item['order_no']} 付款<b>{$item['order_amount']}</b></span></p>
                    {/if}
                    {if:$item['distribution_status']>0}
					<p>{$item['send_time']}&nbsp;&nbsp;<span class="black">订单<b class="orange">全部商品</b>发货完成</span></p>
                    {/if}
                    {if:$item['status']==5}
					<p>{$item['completion_time']}&nbsp;&nbsp;<span class="black">订单完成</span></p>
                    {/if}
				</div>
				<p><b>订单号：</b>{$item['order_no']}<b>下单日期：</b>{$item['create_time']}<b>状态：</b><span class="red2">
                {if:$item['status']==1}
                    {if:$item['pay_type'] == 0}
                    <b class="orange">等待确认</b>
                    {else:}
                    <b class="orange">等待付款</b>
                    {/if}
                {elseif:$item['status']==2}
                    {if:$item['distribution_status']==1}
                    <b class="green">已发货</b>
                    {else:}
                    <b class="orange">等待发货</b>
                    {/if}
                {elseif:$item['status']==3 || $item['status']==4}
                    <b class="green">已取消</b>
                {elseif:$item['status']==5}
                    <b class="green">已完成</b>
                    {if:$item['pay_status']==2}
                        <b class="green">已退款</b>
                    {elseif:$item['pay_status']==3}
                        <b class="green">已申请退款</b>
                    {/if}
                    {if:$item['distribution_status']==2}
                        <b class="green">已退货</b>
                    {elseif:$item['distribution_status']==3}
                        <b class="green">已申请退货</b>
                    {/if}
                {/if}</span></p>
                <form action='{url:/ucenter/order_status}' method='post' {if:$item['status']==1 && $this->pay_type==1}target='_blank'{/if}>
				<p>
                <input name="id" value="{echo:IReq::get('id')}" type="hidden"/>
                {if:$item['status']==1}
                    {if:$this->pay_status==0}
                    <label class="btn_orange"><input type="hidden" name='op' value='cancel'></input><input type="submit" value="取消订单" /></label>
                    {/if}
                    {if:$this->pay_type==1}
					<label class="btn_green"><input type="button" value="立即付款" onclick="window.location.href='{url:/block/doPay/order_id/$item[id]/id/$item[pay_type]}'" /></label>
                    {/if}
                {elseif:$item['status']==2}
                    {if:$item['distribution_status']==1 && $item['pay_type']!=0}
                    <label class="btn_green"><input type="hidden" name='order_no' value='{$item['order_no']}'><input type="hidden" name='op' value='confirm'><input type="submit" value="确认收货" /></label>
                    {/if}
                {elseif:$item['status']==5}
                    {if:$item['pay_status']!=2 && $item['pay_status']!=3 && (time()-strtotime($item['completion_time'])) < 604800 }
                    <label class="btn_orange"><input type="button" value="申请退款" onclick='javascript:window.location.href="{url:/ucenter/refunds/order_no/$item[order_no]}"' /></label>
                    {/if}
                {/if}
                {if:$item['distribution_status']==1 && $item}
                	{set:$sUrl = $this->module->getBasePath().'plugins/freight/company.php';}
                	{if:file_exists ($sUrl) && $this->is_open=='0'}
					<label class="btn_orange"><input type="button" value="快递跟踪" onclick="exdelivry('{$item['id']}')" /></label>
					{/if}
				{/if}
                </p>
                </form>
			</div>
			<div class="box m_10">
				<div class="title"><h2><span class="orange">收件人信息</span></h2>{if:$item['pay_status']==0 || $item['status']>2}<span style="float:right;margin-right:10px" id="accept_state"><a href="javascript:void(0);" onclick="return update();">修改</a>&nbsp;</span>{/if}</div>
				<div class="cont clearfix" id="accept">
					<table class="dotted_table f_l" width="100%" cellpadding="0" cellspacing="0">
						<col width="129px" />
						<col />
						<tr>
							<th>收 货 人：</th>
							<td>{$item['accept_name']}</td>
						</tr>
						<tr>
							<th>地&nbsp;&nbsp;&nbsp;&nbsp;址：</th>
							<td>{$this->area[$item['province']]}{$this->area[$item['city']]}{$this->area[$item['area']]}{$item['address']}</td>
						</tr>
						<tr>
							<th>固定电话：</th>
							<td>{$item['telphone']}</td>
						</tr>
						<tr>
							<th>手机号码：</th>
							<td>{$item['mobile']}</td>
						</tr>
					</table>
				</div>
				<div class="cont clearfix" id="accept_text" style="display:none;">
					<form method="post" action="{url:/ucenter/order_accept}" name="modelForm">
						<table class="dotted_table f_l" width="100%" cellpadding="0" cellspacing="0">
						<col width="129px" />
						<col />
						<tr>
							<th>收 货 人：<input type="hidden" name="freight_real" id="freight_real" value="{$item['real_freight']}"/><input type="hidden" name="order_total" id="order_total" value="{$item['order_amount']}"/></th>
							<td><input class="normal" type="text" id="accept_name" name="accept_name" pattern="required" value="{$item['accept_name']}" alt="收货人姓名错误"/><label>收货人姓名</label><input type="hidden" name="order_id" value="{$item['id']}"/></td>
						</tr>
						<tr>
							<th>地址地区：</th>
							<td><select name="province" id="province" onchange="select_city(this.value,2);">
								<option value="">请选择省份</option>
								{query: name=areas where=parent_id eq 0 item = $area}
								<option value="{$area['area_id']},{$area['area_name']}" {if:$item['province']==$area['area_id']}selected{/if}>{$area['area_name']}</option>
								{/query}
								</select><span id="selec2"></span><span id="selec3"></span><span id="not"></span>
							</td>
						</tr>
						<tr>
							<th>地&nbsp;&nbsp;&nbsp;&nbsp;址：</th>
							<td><input class="normal" type="text" id="address" name="address" pattern="required" value="{$item['address']}" alt="收货地址错误"/><label>收货地址</label></td>
						</tr>
						<tr>
							<th>固定电话：</th>
							<td><input class="normal" type="text" id="telphone" name="telphone" empty pattern="phone" value="{$item['telphone']}" alt="请输入正确的联系电话"/><label>联系电话</label></td>
						</tr>
						<tr>
							<th>手机号码：</th>
							<td><input class="normal" type="text" id="mobile" name="mobile" empty pattern="mobi" maxlength="11" value="{$item['mobile']}" alt="手机号码错误"/><lable></lable></td>
						</tr>
						<tr>
							<th></th><td colspan="2"><label class="btn"><input type="submit" value="保存" /></label></td>
						</tr>
						</table>
					</form>
				</div>
			</div>
			<div class="box m_10">
				<div class="title"><h2><span class="orange">支付及配送方式</span></h2></div>
				<div class="cont clearfix">
					<table class="dotted_table f_l" width="100%" cellpadding="0" cellspacing="0">
						<col width="129px" />
						<col />
						<tr>
							<th>支付方式：</th>
							<td>{$this->pay_name}</td>
						</tr>

						{if:isset($this->pay_note) && $this->pay_note != ''}
						<tr>
							<th>支付说明：</th>
							<td><span id="freight">{$this->pay_note}</span></td>
						</tr>
						{/if}

						<tr>
							<th>运费：</th>
							<td><span id="freight">{$item['real_freight']}</span></td>
						</tr>
						<tr>
							<th>物流公司：</th>
							<td><span id="freight">{$this->deliver_name}</span></td>
						</tr>
						<tr>
							<th>快递单号：</th>
							<td><span id="freight">{$this->deliver_code}</span></td>
						</tr>
					</table>
				</div>
			</div>
            {set:$taxes=0;}
            {if:$item['invoice']==1}
			<div class="box m_10">
				<div class="title"><h2><span class="orange">发票信息</span></h2></div>
				<div class="cont clearfix">
					<table class="dotted_table f_l" width="100%" cellpadding="0" cellspacing="0">
						<col width="129px" />
						<col />
						<tr>
							<th>所需税金：</th>
							<td>{set:$taxes=$item['taxes'];}{$item['taxes']}</td>
						</tr>
						<tr>
							<th>发票抬头：</th>
							<td>{$item['invoice_title']}</td>
						</tr>
					</table>
				</div>
			</div>
            {/if}
			<div class="box m_10">
				<div class="title"><h2><span class="orange">商品清单</span></h2></div>

				<div class="cont clearfix">
					<table class="list_table f_l" width="100%" cellpadding="0" cellspacing="0">
						<tbody>
							<tr>
								<th>图片</th><th>商品名称</th><th>赠送积分</th><th>商品价格</th><th>优惠金额</th><th>商品数量</th><th>小计</th>
							</tr>
                            {set:$total=0;$item_total=0;$point=0;$order_id=$item['id'];$weight=0;}
                            {query:name=order_goods as o join=left join goods as go on o.goods_id eq go.id  where=o.order_id eq $order_id item=$good }
                            {set:$good_info=unserialize($good['goods_array']);$weight += $good['goods_nums']*$good['goods_weight'];}
							<tr>
								<td><img class="pro_pic" src="{webroot:$good[list_img]}" width="50" height="50" onerror='this.src="{skin:images/front/nopic_100_100.gif}"' /></td>
								<td class="t_l"><a class="blue" href="{url:/site/products/id/$good[id]}" target='_blank'>{if:$good_info['value']!=''}{$good_info['name']}{else:}{$good['name']}{/if}</a>{if:$good_info['value']!=''}<br />&nbsp;&nbsp;{$good_info['value']}{/if}</td>
								<td>{set:$point += $good['point']}{$good['point']}</td>
								<td class="red2">￥{$good['goods_price']}</td>
								<td class="red2">￥{echo:sprintf("%01.2f",(($good['goods_price']-$good['real_price'])))}</td>
								<td>x{$good['goods_nums']}</td>
								<td class="red2 bold">￥{set:$item_total = ($good['real_price']*$good['goods_nums']); $total += $item_total;}{echo:sprintf("%01.2f",$item_total)}</td>
							</tr>
                            {/query}
						</tbody>
					</table>
				</div>
			</div>
			<div class="gray_box">
				<div class="t_part">
					<p>商品总金额：￥{$item['payable_amount']}</p>
					<p>+ 运费：￥<span id="real_freight">{$item['real_freight']}</span></p>
                    {if:$taxes>0}<p>+ 税金：￥{$taxes}{set:$total+=$taxes;}</p>{/if}
                    {if:$item['pay_fee']>0}<p>+ 支付手续费：￥{$item['pay_fee']}</p>{/if}
                    {if:$item['discount']>0}<p>订单折扣或涨价：￥{$item['discount']}</p>{/if}
                    <p>- 促销优惠金额：￥{$item['promotions']}</p>
				</div>
				<div class="b_part">
					<p>订单支付金额：<span class="red2" id="red2">￥{$item['order_amount']}</span></p>
				</div>
			</div>
		</div>
<script type="text/javascript">
function exdelivry(id)
{
	var tempUrl = '{url:/block/exdelivry/id/@id@}';
		tempUrl = tempUrl.replace('@id@',id);
	art.dialog.open(tempUrl,{
		id:'exdelivry',
		width:'700px',
		height:'500px',
	    title: '快递跟踪'
	});
}
var province_va = '';
var city_va = '';
var area_va = '';
{if:$item['province']!=''}
province_va = '{$item['province']}'+','+'{$this->area[$item['province']]}';
city_va = '{$item['city']}'+','+'{$this->area[$item['city']]}';
area_va = '{$item['area']}'+','+'{$this->area[$item['area']]}';
{/if}
function update()
{
	if(city_va!='')
	{
		select_city(province_va,'2');
	}
	if(area_va!='')
	{
		select_city(city_va,'3');
	}
	$('#accept').hide();
	$('#accept_text').show();
}
function accept_save()
{
	var accept_name = $.trim($('#accept_name').val());
	var province = $('#province').val();
	var city = $('#city').val();
	var area = $('#area').val();
	if(accept_name == '')
	{
		alert('请输入收货人的姓名!');
		return false;
	}
	if(province=='')
	{
		alert('请选择省份!');
		return false;
	}
	if(city=='')
	{
		alert('请选择城市!');
		return false;
	}
	if(area=='')
	{
		alert('请选择地区!');
		return false;
	}
	var address = $.trim($('#address').val());
	var mobile = $.trim($('#mobile').val());
	if(address=='')
	{
		alert('请输入地址!');
		return false;
	}
	if(mobile=='')
	{
		alert('请输入手机号码!');
		return false;
	}
	window.document.modelForm.submit();
}
function select_city(city,style)
{
	var arr = city.split(',');
	$.getJSON("{url:/block/area_child}",{aid:arr[0],random:Math.random()}, function(json)
	{
		if(style==2)
		{
			var select_html = '<select name="city" id="city" onchange="select_city(this.value,3);">';
			select_html += '<option value="">请选择城市</option>';
			for( a in json)
			{
				if((json[a]['area_id']+','+json[a]['area_name'])==city_va)
				{
					select_html +='<option value="'+json[a]['area_id']+','+json[a]['area_name']+'" selected>'+json[a]['area_name']+'</option>';
				}
				else
				{
					select_html +='<option value="'+json[a]['area_id']+','+json[a]['area_name']+'">'+json[a]['area_name']+'</option>';
				}
			}
			delivery(arr[0]);
			select_html +='</select>';
			if($("#selec3").text()=='')$("#selec3").hide();
			$("#selec2").html(select_html);
		}
		if(style==3)
		{
			if(json.length>0)
			{
				var select_html = '<select name="area" id="area" onchange="select_city(this.value,4);">';
				select_html += '<option value="">请选择地区</option>';
				for( a in json)
				{
					if((json[a]['area_id']+','+json[a]['area_name'])==area_va)
					{
						select_html +='<option value="'+json[a]['area_id']+','+json[a]['area_name']+'" selected>'+json[a]['area_name']+'</option>';
						if(area_va!='')
						{
							select_city(area_va,4);
						}
					}
					else
					{
						select_html +='<option value="'+json[a]['area_id']+','+json[a]['area_name']+'">'+json[a]['area_name']+'</option>';
					}
				}
				select_html +='</select>';
				$("#selec3").show();
				$("#selec3").html(select_html);
			}
		}
	});
}
function delivery(id)
{
	//通过省份id查询出配送方式，并且传送总重量计算出运费,然后显示配送方式
	var weight = '{$weight}';
	var distribution = '{$item['distribution']}';
	var de_id = '';
	$.getJSON("{url:/block/order_delivery}",{province:id,weight:weight,random:Math.random()},
		function(json){
		var html_va = '';
		for( a in json)
		{
			if(json[a]['if_delivery']==0)
			{
				if(json[a]['id']==distribution)
				{
					html_va = json[a]['price'];
					//计算
					var real_freight = '{$item['real_freight']}';
					var total = '{$item['order_amount']}';
					if(parseInt(html_va)!=parseInt(real_freight))
					{
						var total = parseInt(total)-parseInt(real_freight)+parseInt(html_va)
						$('#red2').html(total);
						$('#real_freight').html(html_va);
						$('#order_total').val(total);
						$('#freight_real').val(html_va);
						$('#not').html('该订单的运费发生变化，请注意订单总金额!');
					}
				}
			}
			else
			{
				if(json[a]['id']==distribution)
				{
					html_va = '该地区无法送到';
				}
			}
		}
		$("#freight").html(html_va);
	});
}
</script>
